<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%request.setCharacterEncoding("utf-8");%>
<%@ page import="java.util.UUID"%>
<%@ include file="pub/top_list2.jsp"%>   
<%
String names = (String) request.getSession().getAttribute("name");
String swiftid="";
for (int l = 0; l < 10; l++) {
	String uuid = UUID.randomUUID().toString().replaceAll("-", "");
	swiftid=uuid;
}
//System.out.println(request.getParameter("cz"));
if(request.getParameter("cz")!=null&&request.getParameter("cz")!=""){
	//System.out.println(request.getParameter("cz"));
	BigDecimal buyprice=new BigDecimal(request.getParameter("buyprice"));
	BigDecimal buycount=new BigDecimal(request.getParameter("buycount"));
	BigDecimal epoint=buyprice.multiply(buycount);
	int classid=Integer.valueOf(request.getParameter("cz"));
	String comment="";
	if(classid==2){
		comment="银行卡充值现金币";
	}else if(classid==3){
		comment="支付宝充值现金币";
	}else{
		comment="微信充值现金币";
	}
	String sql = "insert into chongzhi(swiftid,userid,epoint,ispay,classid,comment,rdt) values(?,?,?,0,?,?,now())";
	Object[] param=new Object[5];	
	param[0] =swiftid;
	param[1] =names; 
	param[2] =epoint;
	param[3] =classid;
	param[4] =comment;
	db.executeUpdate(sql, param);
}

%>

<script>   
function fun1(){	
	if($(".cz1 label").hasClass('checkd')){
		$(".cz1 label").addClass("checkd");
		$(".cz2 label").removeClass("checkd");
		$(".cz3 label").removeClass("checkd");
		document.getElementById("cz").value=2;
		$('#yhkfk').show('slow');
		$('#zfbfk').hide('slow');
		$('#wxfk').hide('slow');
	}
}
function fun2(){
	if($(".cz2 label").hasClass('checkd')){
		$(".cz1 label").removeClass("checkd");
		$(".cz2 label").addClass("checkd");
		$(".cz3 label").removeClass("checkd");
		document.getElementById("cz").value=3;
		$('#zfbfk').show('slow');
		$('#yhkfk').hide('slow');
		$('#wxfk').hide('slow'); 
	}
}
function fun3(){
	if($(".cz3 label").hasClass('checkd')){
		$(".cz1 label").removeClass("checkd");
		$(".cz2 label").removeClass("checkd");
		$(".cz3 label").addClass("checkd");
		document.getElementById("cz").value=4;
		$('#wxfk').show('slow');
		$('#zfbfk').hide('slow');
		$('#yhkfk').hide('slow'); 
	}
}
  /*  function  getRadio(){  
        e  =  event.srcElement;
         if(e.type=="radio"  &&  e.name=="fkfs")  
        alert("你点击的Radio按钮值为"+e.value); 
		if(e.id=='yhk'){
			document.getElementById("cz").value=2;
			$('#yhkfk').show('slow');
			$('#zfbfk').hide('slow');
			$('#wxfk').hide('slow');
     	}else if(e.id=='zfb'){
     		document.getElementById("cz").value=3;
     		$('#zfbfk').show('slow');
			$('#yhkfk').hide('slow');
			$('#wxfk').hide('slow');
     	}else{
     		document.getElementById("cz").value=4;
     		$('#wxfk').show('slow');
			$('#zfbfk').hide('slow');
			$('#yhkfk').hide('slow');
    	}
  } */
  </script>

<body>
	<header class="top-header fixed-header">
		<a class="icona" href="balance.jsp">
				<img src="images/left.png"/>
			</a>
		<h3>充值</h3>			
			
	</header>
	
	<div class="contaniner fixed-conta">
		<form action="chongzhi.jsp" method="post" class="change-address" id="save">
			<ul>
				<li>
					<label class="addd">买入价：</label>
					<input type="text" name="buyprice" value="1.00" />
				</li>
				<li>
					<label class="addd">买入量：</label>
					<input type="text" name="buycount" value="" required="required" />
				</li>
				
				<li>
					<label class="addd">付款方式：</label>
					<ul>
						<li class="cz1" style="border-bottom: solid 1px #fff;">
						<input type="checkbox"  id="yhk" value="2" onclick="fun1()"/>
						<label class="check" style="margin-left:80px;width:180px;"  for="yhk" onselectstart="return false"  >银行卡付款</label>
						</li>
						<li class="cz2" style="border-bottom: solid 1px #fff;">
						<input type="checkbox"  id="zfb" value="3"  onclick="fun2()"/>
						<label class="check" style="margin-left:80px;width:180px;" for="zfb" onselectstart="return false"  >支付宝付款</label>
						</li>
						<li class="cz3" style="border-bottom: solid 1px #fff;">
						<input type="checkbox"  id="wx" value="4" onclick="fun3()"/>
						<label class="check" style="margin-left:80px;width:180px;" for="wx" onselectstart="return false"  >微信付款</label>
						</li>
					
					</ul>					
					
					<!-- <span style="font-size:14px;" onclick="getRadio();">	
						<input type="radio" name="fkfs" value="yhk"  checked></input><br>
						<input type="radio" name="fkfs" value="zfb" >支付宝付款</input><br>
						<input type="radio" name="fkfs" value="wx" >微信付款</input>
					</span> -->
					<input type="text" name="cz" id="cz" value=""  style="display:none"/>
				</li>
				<li id="yhkfk" >
					<label class="addd">银行卡号：</label>
					<input type="text" name="yhkh" value="111111111111111111" required="required"/>
				</li>
				<li id="zfbfk" style="display:none;">
					<label class="addd">支付宝账号：</label>
					<input type="text" name="zfbzh" value="18111518902" required="required"/>
				</li>
				<li id="wxfk" style="display:none;">
					<label class="addd">微信账号：</label>
					<img src="img/touxiang.png">
				</li>
			</ul>		
			<input type="submit" value="保存" />
		</form>
	</div>
	<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
	$(".cz1 label").on('touchstart',function(){
		if($(this).hasClass('checkd')){
			$(".cz1 label").removeClass("checkd");
		}else{
			$(".cz1 label").addClass("checkd");
		}
	})
	$(".cz2 label").on('touchstart',function(){
		if($(this).hasClass('checkd')){
			$(".cz2 label").removeClass("checkd");
		}else{
			$(".cz2 label").addClass("checkd");
		}
	})
	$(".cz3 label").on('touchstart',function(){
		if($(this).hasClass('checkd')){
			$(".cz3 label").removeClass("checkd");
		}else{
			$(".cz3 label").addClass("checkd");
		}
	})
	</script>

</body>
</html>